<template>
	<view class="">
		<view class="font-27 color-hui text-center mt-2">
			该小程序内容仅供娱乐
		</view>
		
		<view class="test-list">
			<ad style="width: auto; !important" :unit-id="adUnitIdbanner" v-if="advertisingOpen && adUnitIdbanner"></ad>
		    <view @tap="testItemBtn(item)" class="test-item flex"  v-for="(item,index) in testList" :key="index">
		        <image class="test-image" :src="item.image"></image>
		        <view>
				
		            <view class="test-title single-line">{{item.title}}</view>
		            <view class="test-count flex">
		                <view class="test-count-test">{{item.viewCount}}人测试过</view>
		                <view class="test-count-like">{{item.likeCount}}人觉得准确</view>
		            </view>
		        </view>
		    </view>
		</view>
		<modal ref="modal"></modal>
	</view>
</template>

<script>
	import {
		advertisingData11
	} from "@/mixin/advertisingData1.js"
	export default {
		mixins: [advertisingData11],
		data(){
			return {
				testList:[],
				adUnitIdbanner:""
			}
		},
		onLoad() {
			this.getTestIssueList()
			this.adUnitIdbanner = this.advertisingData1(this.advertisingDataType.bannerList)
		},
		methods:{
			async getTestIssueList() {
				var data = await this.$api.getData({
					dbName: "wx_test_issue",
					pageIndex: 1,
					pageSize: 10,
					// order: {
					// 	name: 'id',
					// 	type: 'asc'
					// }
				})
				this.testList = data.rows
			},
			testItemBtn(item,index){
				var vipConfig = uni.getStorageSync('vipConfig')
				var user = uni.getStorageSync('user')
				if(!user && vipConfig.isSearchLogin){
					this.$refs['modal'].modalName = 'Modal'
					return
				}
				uni.navigateTo({
					url: "/pages/test-lssue/details?title=" + item.title + '&_id=' + item.id
				})
			}
		}
	}
</script>
<style>
	page{
		background: #fff;
	}
	
</style>
<style scoped>
	.single-line{
		display: inline-block;
		 white-space: nowrap; 
		 width: 100%; 
		 overflow: hidden;
		 text-overflow:ellipsis;
	}
	.flex{
		display: flex;
	}
	.test-item {
	  
	    margin-left: 30rpx;
	    padding: 30rpx 30rpx 30rpx 0;
	    border-bottom: 1rpx solid #eee;
	}
	
	.test-image {
	    width: 120rpx;
	    height: 120rpx;
	    border-radius: 15rpx;
	}
	
	.test-title {
	    font-size: 30rpx;
	    font-weight: 700;
	}
	
	.test-count,.test-title {
	    width: 540rpx;
	    height: 60rpx;
	    margin-left: 30rpx;
	    line-height: 60rpx;
	}
	
	.test-count {
	    font-size: 22.5rpx;
	    color: #888;
	}
	
	.test-count-test {
	    width: 270rpx;
	}
	
	.test-count-like {
	    width: 270rpx;
	    text-align: right;
	}
</style>
